home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
com
/
computer
/
casio_st
/
prog_fx
/
divers
/
robot2.sha
< prev
next >
Wrap
Text File
|
1994-03-01
|
4KB
|
145 lines
5 CLEAR:DIMTP$(1,4):DIMTx$(4,4),TX$(4,4),TI$(4,4),IND(4,4)
10 GOSUB 650:GOSUB 1000
32 GOSUB 360:A=NB
35 FORIX=A TO 1 STEP-1
37 GOSUB400
40 GOSUB100
45 GOSUB300
46 CLS:GOSUB700
47 CLS:GOSUB1050
50 NEXT IX
95 END
100 REM<K-1/K>
105 FORI=1 TO 4:FORJ=1 TO 4:Tx$(I,J)="0":NEXTJ:NEXTI:Tx$(4,4)=""
110 REM COEF
115 C1$="0":S1$="0":C4$="0":S4$="0"
120 I=COS(VAL(TP$(1,1)))
125 IF I=0 THEN 150 ELSE 130
130 IF I=1 THEN C1$="" ELSE C1$="-"
140 GOTO 170
150 I=SIN(VAL(TP$(1,1))
160 IF I=1 THEN S1$="" ELSE S1$="-"
170 IF TP$(1,4)<>"0" THEN 171 ELSE C4$="":GOTO 190
171 A$=LEFT$(TP$(1,4),1)
172 IF A$="G" THEN 173 ELSE 175
173 I=ASC(RIGHT$(STR$(IX),1)):C4$="c"+CHR$(I):S4$="s"+CHR$(I):GOTO 190
175 I=COS(VAL(TP$(1,4)))
176 IF I=0 THEN 178 ELSE 177
177 IF I=1 THEN C4$="" ELSE C4$="-":GOTO 190
178 I=SIN(VAL(TP$(1,4))
179 IF I=1 THEN S4$="" ELSE S4$="-"
190 REM
195 Tx$(1,1)=C4$
200 IF S4$="0" THEN 210 ELSE 205
205 IF S4$="-" THEN Tx(1,2)="":GOTO 210
206 IF S4$="" THEN Tx$(1,2)="-" ELSE Tx$(1,2)="-"+S4$
210 Tx$(1,4)=TP$(1,2)
220 IF C1$="0" THEN 225 ELSE 250
225 A$=S4$:B$=S1$:GOSUB 500:Tx$(3,1)=R$
230 A$=C4$:B$=S1$:GOSUB 500:Tx$(3,2)=R$
235 IF S1$="" THEN Tx$(2,3)="-" ELSE Tx$(2,3)=""
240 IF TP$(1,3)<>"0" THEN Tx$(2,4)=Tx$(2,3)+TP$(1,3)
245 GOTO 290
250 A$=S4$:B$=C1$:GOSUB 500:Tx$(2,1)=R$
260 A$=C4$:B$=C1$:GOSUB 500:Tx$(2,2)=R$
270 Tx$(3,3)=C1$
275 IF TP$(1,3)<>"0" THEN Tx$(3,4)=Tx$(3,3)+TP$(1,3)
290 RETURN
300 CLS:PRINT"<";IX-1;"/";IX;">"
304 FORI=1 TO 4
305 FORJ=1 TO 4
307 A$=Tx$(I,J):IF A$="" THEN A$="1"
308 IF A$="-" THEN A$="-1"
310 PRINT A$;";";
315 NEXTJ:PRINT""
320 NEXTI
350 REM MEMO
360 RESTORE#:RESTORE#"ROBOT":READ#A$
370 READ#NB
380 RETURN
400 GOSUB360
410 FORI=1 TO (IX-1)*4:READ#A$:NEXTI
420 FORI=1 TO 4:READ#TP$(1,I):NEXTI
430 RETURN
500 R$="0":REM PRINT"A=";A$;" B=";B$
510 IF A$="-" THEN 511 ELSE 520
511 IF B$="" THEN R$="-" ELSE R$=""
512 GOTO 600
520 IF A$="" THEN 521 ELSE 530
521 IF B$="" THEN R$="" ELSE R$="-"
522 GOTO 600
530 IF A$="0" THEN 600
540 R$=B$+A$
600 RETURN
650 REM OUTIL
660 RESTORE#"OUTIL":READ#A$
670 FORI=1 TO 4:FORJ=1 TO 4:READ#TX$(I,J):NEXTJ:NEXTI:RETURN
700 REM PROD MAT
710 FOR I=1 TO 4
715 FOR J=1 TO 4
717 LOCATE 0,0:PRINT"[";I;" ";J;"]";
720 R$="0"
725 FOR U=1 TO 4
730 A$=Tx$(I,U):B$=TX$(U,J)
735 P$="":GOSUB 800:IF P$="0" THEN 745 ELSE R$=R$+P$
745 NEXTU
746 IF (LEN(R$)>1) AND (LEFT$(R$,1)="0") THEN R$=RIGHT$(R$,LEN(R$)-1)
747 IF (LEFT$(R$,1)="+") THEN R$=RIGHT$(R$,LEN(R$)-1):GOTO 747
749 TI$(I,J)=R$
750 NEXTJ
755 NEXTI
760 RETURN
800 IL=1:IC=1:REM CONFIG
810 IF (A$="0") OR (B$="0") THEN P$="0":GOTO 860
815 IF A$="" THEN IL=1
820 IF A$="-" THEN IL=2
825 IF (LEN(A$)>1) OR (ASC(A$)>64) THEN 830 ELSE 840
830 IF LEFT$(A$,1)="-" THEN IL=4 ELSE IL=3
840 IF B$="" THEN IC=1
845 IF B$="-" THEN IC=2
850 IF (LEN(B$)>1) OR (ASC(B$>64) THEN 855 ELSE 856
855 IF LEFT$(B$,1)="-" THEN IC=4 ELSE IC=3
856 ON IND(IL,IC) GOSUB 900,910,920,930,940,950,960,970
860 RETURN
900 P$="+":RETURN
910 P$="-":RETURN
920 P$="+"+A$+B$:RETURN
930 P$=A$+B$:RETURN
940 RETURN
950 P$=A$:GOSUB 1200:RETURN
960 P$=B$:GOSUB 1200:RETURN
970 GOSUB 1400:RETURN
1000 DATA 1,2,3,4,2,1,7,7,3,6,8,8,4,6,8,8
1010 RESTORE 1000:FORI=1 TO 4:FORJ=1 TO 4:READIND(I,J):NEXTJ:NEXTI:RETURN
1050 REM TRANSF TX<-TI
1055 PRINT"<";IX-1;"/E>"
1060 FORI=1 TO 3
1070 FORJ=1 TO 4
1080 TX$(I,J)=TI$(I,J):PRINT TX$(I,J);";";:TI$(I,J)="0"
1090 NEXTJ:PRINT""
1100 NEXTI
1110 RETURN
1200 K=0:REM INVP
1210 K=K+1
1220 L$=MID$(P$,K,1):IF (K=1) AND (ASC(L$)>46) THEN P$="-"+P$
1230 IF L$="+" THEN P$=LEFT$(P$,K-1)+"-"+RIGHT$(P$,LEN(P$)-K) ELSE IF L$="-" THEN P$=LEFT$(P$,K-1)+"+"+RIGHT$(P$,LEN(P$)-K)
1240 IF K>=LEN(P$) THEN RETURN ELSE GOTO 1210
1300 REM PROD
1315 K=1:P$="":S$=MID$(G$,IY,1)
1317 IF (IY+K)>LEN(G$) THEN 1320
1318 L$=MID$(G$,IY+K,1):IF (L$="+") OR (L$="-") THEN GOTO 1320 ELSE K=K+1:GOTO 1317
1320 P$=MID$(G$,IY+1,K-1):IY=IY+K:RETURN
1400 IF ASC(MID$(A$,1,1)<46 THEN 1405 ELSE A$="+"+A$
1405 IF ASC(MID$(B$,1,1)<46 THEN 1410 ELSE B$="+"+B$
1410 PT$="":NA=0:NB=0
1412 FORK=1 TO LEN(A$):IF ASC(MID$(A$,K,1))<46 THEN NA=NA+1
1413 NEXT
1414 FORK=1 TO LEN(B$):IF ASC(MID$(B$,K,1))<46 THEN NB=NB+1
1415 NEXT:IA=1:IB=1
1417 FORN=1 TO NA
1420 G$=A$:IY=IA:GOSUB 1300:IA=IY:PA$=P$:SA$=S$
1422 FORM=1 TO NB
1425 G$=B$:IY=IB:GOSUB 1300:IB=IY:PB$=P$:SB$=S$
1430 IF SA$=SB$ THEN P$="+"+PA$+PB$ ELSE P$="-"+PA$+PB$
1431 PT$=PT$+P$:NEXT:IB=1:NEXT:P$=PT$:RETURN